package BehaviorModel.mediatorModel;

public class TVColleague extends Colleague{
    public TVColleague(Mediator mediator,
                       String name) {
        super(mediator,
              name);
        mediator.registerMediator(name,this);
    }


    /**
     * 功能描述: 开启电视
     */
    public void startTV(){
        System.out.println(" 打开电视机 ");
        sendMessage(1);
    }

    /**
     * 功能描述: 关闭电视
     */
    public void stopTV(){
        System.out.println(" 关闭电视机 ");
        sendMessage(0);
    }

    /**
     * 功能描述: 发送信息到中介者
     *
     * @param stateChange
     */
    @Override
    public void sendMessage(int stateChange) {
        this.getMediator().getMessage(stateChange,this.name);
    }
}
